﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace Triples {
    public abstract class ScoreCard : INotifyPropertyChanged {
        public event PropertyChangedEventHandler PropertyChanged;

        private int _Score;

        public int Score {
            get { return _Score; }
            protected set { Set(ref _Score, value, "Score"); }
        }


        public ScoreCard () {
            Score = 0;
        }

        protected abstract int GetSetScore();


        public void ScoreSet () {
            Score += GetSetScore();
        }


        private void Set<T>(ref T var, T val, string name) {
            var = val;
            OnPropertyChanged(name);
        }


        private void OnPropertyChanged(string param) {
            PropertyChangedEventHandler ev = PropertyChanged;

            if (null != ev) ev (this, new PropertyChangedEventArgs(param));
        }
    }
}
